package com.ruoyi.wm.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.wm.domain.WmApparatusInventory;
import com.ruoyi.wm.service.IWmApparatusInventoryService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 医疗器械库存清算Controller
 * 
 * @author hpf
 * @date 2021-11-28
 */
@Controller
@RequestMapping("/wm/apparatus_Inventory_list")
public class WmApparatusInventoryController extends BaseController
{
    private String prefix = "wm/apparatus_Inventory_list";

    @Autowired
    private IWmApparatusInventoryService wmApparatusInventoryService;

    @GetMapping()
    public String apparatus_Inventory_list(String name,Model model)
    {
        model.addAttribute("name",name);
        return prefix + "/apparatus_Inventory_list";
    }

    /**
     * 查询医疗器械库存清算列表
     */
    @RequiresPermissions("wm:apparatus_Inventory_list:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(String name)
    {
        startPage();
        List<WmApparatusInventory> list = wmApparatusInventoryService.selectWmApparatusInventoryByName(name);
        return getDataTable(list);
    }
    /**
     * 导出医疗器械库存清算列表
     */
    @RequiresPermissions("wm:apparatus_Inventory_list:export")
    @Log(title = "医疗器械库存清算", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(WmApparatusInventory wmApparatusInventory)
    {
        List<WmApparatusInventory> list = wmApparatusInventoryService.selectWmApparatusInventoryList(wmApparatusInventory);
        ExcelUtil<WmApparatusInventory> util = new ExcelUtil<WmApparatusInventory>(WmApparatusInventory.class);
        return util.exportExcel(list, "apparatus_Inventory_list");
    }
}
